import { promotionTypeList } from '@/type';

export function filterPromotionTypeByName(name: string) {
  const arr = promotionTypeList.filter((item) => item.name === name);
  return (arr.length && arr[0].code) || '';
}

export function filterType(data: any[] = [], val, code = 'code', name = 'name') {
  const arr = data.filter((item) => item[code] == val);
  return (arr.length && arr[0][name]) || '';
}
